<?php
namespace Activity\Config;

use Phalcon\Mvc\Router\Annotations as RouterAnnotations;

/**
 * 加载路由
 */
$router = new RouterAnnotations(false);

$router->setDefaultNamespace('Activity\Controllers');
$router->setDefaultController('index');
$router->setDefaultAction('index');
$router->setUriSource(RouterAnnotations::URI_SOURCE_SERVER_REQUEST_URI);
$router->removeExtraSlashes(true);

$router->notFound([
    'namespace'  => 'Activity\Controllers',
    'controller' => 'error',
    'action'     => 'show404'
]);

$router->add('/index.php', [
    'namespace'  => 'Activity\Controllers',
    'controller' => 'index',
    'action'     => 'index',
]);

$router->add('/', [
    'namespace'  => 'Activity\Controllers',
    'controller' => 'index',
    'action'     => 'index',
]);
$router->add('/:controller', [
    'namespace'  => 'Activity\Controllers',
    'controller' => 1,
    'action'     => 'index',
]);

$router->add('/:controller/:action/:params', [
    'namespace'  => 'Activity\Controllers',
    'controller' => 1,
    'action'     => 2,
    'params'     => 3
]);

$router->add('/activity/:controller/:action/:params', [
    'namespace'  => 'Activity\Controllers\Activity',
    'controller' => 1,
    'action'     => 2,
    'params'     => 3,
]);

return $router;
